Finding crime patterns in Montgomery County

Group components

  • Cephas Barreto- cephasax [at] gmail [dot] com>
  • Marco Olimpio - marco.olimpio [at] gmail [dot] com
  • Rebecca Betwel - bekbetwel [at] gmail [dot] com

About the dataset

The data presented is derived from reported crimes classified according to Maryland criminal code and documented by approved police incident reports. The data about crimes do not put info about the victins and its masks the actual address not putting the exact place where the complaint occured.


Source: https://data.world/jboutros/montgomery-county-crime

Maryland County Area


Checking about data available

  • Incident ID: Looks like a simple table identification number
  • CR Number: CR stands for Complaint Register and its a identification for a Compleint Process for a full disciplinary investigation
  • Dispatch Date/Time: Looks the date and time when the complaint was made
  • Class
    • Class number:Identification number of the complaint
    • Class description:Description of the class
  • Complaint
    • Public place
      • Police District Name: Auto describes it
      • Police District Number: Auto describes it
      • Block address: Auto describes it
      • City: Auto describes it
      • State: Auto describes it
      • Zip Code: Auto descrives it
      • Agency: Agency responsable for this address
      • Place: Kind of place where the crime occured
      • Sector
        • Rockville District: Sectors A, B, C
        • Bethesda District: Sectors D, E
        • Silver Spring District: Sector G
        • Wheaton-Glenmont District: Sector J, K
        • Germantown District: Sectors M, N, P
      • Address Number: Auto describes it
      • Beat: Beat is the territory and time that a police officer patrols
      • PRA: Police Reporting Area
      • Latitude: Auto describes it
      • Longitude: Auto describes it
      • Location: Tuple of Latitude and Longitude
    • Complaint estimative
      • Start Data/Time: Start of the complaint
      • End Date/Time: End of the complaint

Dataset questions

  • About Type of complaint
    • Which complaint is most common?
    • What are the categories of complaints?
    • Could we categorize the types of crimes in violent or not?
  • About Period of time/day of the week
    • Wich period of the day that most complaints occur
    • Wich day of the week that most complaints occur
    • Wich month of the years that most complaints occur
    • These complainsts are realted with holidays?
    • What period of time (time of day/day of the week/month of the year) has correlation with the type of complaint
  • About Location
    • Where is most of the complaints?
    • What sort of places have most complaints
    • What sort of place has correlation with the type of complaint
  • Correlation between locale and type of complaint
    • Is there a correlations between the day of the week and kind of complaint?

References

  • https://www.montgomerycountymd.gov/pol/districts/whatsmydistrict.html
  • http://www.ericcarlson.net/scanner/police.html

Importing libraries Pandas and Bokeh and configuring Bokeh to show chart inline (calling output_notebook() function)


In [406]:
import pandas as pd
import numpy  as np
from bokeh.io import push_notebook, show, output_notebook
from bokeh.layouts import row
from bokeh.plotting import figure
from bokeh.models import (
    GMapPlot, GMapOptions, ColumnDataSource, Circle, DataRange1d, PanTool, WheelZoomTool, BoxSelectTool
)
output_notebook()


Loading BokehJS ...

Configuring maps and loading data about where the complaints have occured. Observe, to sucesfully configure the Google Maps you have to create an API Key (You can generate one from this site: https://developers.google.com/maps/documentation/javascript/get-api-key) and change in the line 'plot.api_key = ""'


In [407]:
map_options = GMapOptions(lat=39.151042, lng=-77.193023, map_type="roadmap", zoom=11)

plot = GMapPlot(x_range=DataRange1d(), y_range=DataRange1d(), map_options=map_options)
plot.title.text = "Montgomery County"

# For GMaps to function, Google requires you obtain and enable an API key:
#
#     https://developers.google.com/maps/documentation/javascript/get-api-key
#
# Replace the value below with your personal API key:
plot.api_key = "AIzaSyBFHmpkUOfk2FtDZXHVBSUUHp6LVPmI-fs"

Load data in using read_csv function, configure which tools will be available in the plot.


In [408]:
#Loading dataset from Montgomery County complaint dataset
monty_data = pd.read_csv("MontgomeryCountyCrime2013.csv")
latitude_data = monty_data["Latitude"]
longitude_data = monty_data["Longitude"]
monty_data.head()


Out[408]:
Incident ID CR Number Dispatch Date / Time Class Class Description Police District Name Block Address City State Zip Code ... Sector Beat PRA Start Date / Time End Date / Time Latitude Longitude Police District Number Location Address Number
0 200939101 13047006 10/02/2013 07:52:41 PM 511 BURG FORCE-RES/NIGHT OTHER 25700 MT RADNOR DR DAMASCUS MD 20872.0 ... NaN NaN NaN 10/02/2013 07:52:00 PM NaN NaN NaN OTHER NaN 25700.0
1 200952042 13062965 12/31/2013 09:46:58 PM 1834 CDS-POSS MARIJUANA/HASHISH GERMANTOWN GUNNERS BRANCH RD GERMANTOWN MD 20874.0 ... M 5M1 470.0 12/31/2013 09:46:00 PM NaN NaN NaN 5D NaN NaN
2 200926636 13031483 07/06/2013 09:06:24 AM 1412 VANDALISM-MOTOR VEHICLE MONTGOMERY VILLAGE OLDE TOWNE AVE GAITHERSBURG MD 20877.0 ... P 6P3 431.0 07/06/2013 09:06:00 AM NaN NaN NaN 6D NaN NaN
3 200929538 13035288 07/28/2013 09:13:15 PM 2752 FUGITIVE FROM JUSTICE(OUT OF STATE) BETHESDA BEACH DR CHEVY CHASE MD 20815.0 ... D 2D1 11.0 07/28/2013 09:13:00 PM NaN NaN NaN 2D NaN NaN
4 200930689 13036876 08/06/2013 05:16:17 PM 2812 DRIVING UNDER THE INFLUENCE BETHESDA BEACH DR SILVER SPRING MD 20815.0 ... D 2D3 178.0 08/06/2013 05:16:00 PM NaN NaN NaN 2D NaN NaN

5 rows × 22 columns

Categorizing complaint classes


In [409]:
#Creating a master class to categorize crimes
classaux = monty_data["Class"]/100
classaux = classaux.astype(int)
classaux = classaux*100
#Inserting this new data in the dataset
monty_data["MasterClass"] = classaux

#print(montydata.groupby("Class")["Class Description"].mean())
#Sort by Class of complaint to analise master classes of Class complaints
#montydata.sort_values(by="Class")
#montydata.sort_values(by="Class Description")
monty_data["Class","Class Description"]
#print(montydata.groupby["Class Description"])


---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/Users/marco/anaconda/lib/python3.6/site-packages/pandas/indexes/base.py in get_loc(self, key, method, tolerance)
   2133             try:
-> 2134                 return self._engine.get_loc(key)
   2135             except KeyError:

pandas/index.pyx in pandas.index.IndexEngine.get_loc (pandas/index.c:4433)()

pandas/index.pyx in pandas.index.IndexEngine.get_loc (pandas/index.c:4279)()

pandas/src/hashtable_class_helper.pxi in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:13742)()

pandas/src/hashtable_class_helper.pxi in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:13696)()

KeyError: ('Class', 'Class Description')

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
<ipython-input-409-33e34c17e2c8> in <module>()
     10 #montydata.sort_values(by="Class")
     11 #montydata.sort_values(by="Class Description")
---> 12 monty_data["Class","Class Description"]
     13 #print(montydata.groupby["Class Description"])

/Users/marco/anaconda/lib/python3.6/site-packages/pandas/core/frame.py in __getitem__(self, key)
   2057             return self._getitem_multilevel(key)
   2058         else:
-> 2059             return self._getitem_column(key)
   2060 
   2061     def _getitem_column(self, key):

/Users/marco/anaconda/lib/python3.6/site-packages/pandas/core/frame.py in _getitem_column(self, key)
   2064         # get column
   2065         if self.columns.is_unique:
-> 2066             return self._get_item_cache(key)
   2067 
   2068         # duplicate columns & possible reduce dimensionality

/Users/marco/anaconda/lib/python3.6/site-packages/pandas/core/generic.py in _get_item_cache(self, item)
   1384         res = cache.get(item)
   1385         if res is None:
-> 1386             values = self._data.get(item)
   1387             res = self._box_item_values(item, values)
   1388             cache[item] = res

/Users/marco/anaconda/lib/python3.6/site-packages/pandas/core/internals.py in get(self, item, fastpath)
   3541 
   3542             if not isnull(item):
-> 3543                 loc = self.items.get_loc(item)
   3544             else:
   3545                 indexer = np.arange(len(self.items))[isnull(self.items)]

/Users/marco/anaconda/lib/python3.6/site-packages/pandas/indexes/base.py in get_loc(self, key, method, tolerance)
   2134                 return self._engine.get_loc(key)
   2135             except KeyError:
-> 2136                 return self._engine.get_loc(self._maybe_cast_indexer(key))
   2137 
   2138         indexer = self.get_indexer([key], method=method, tolerance=tolerance)

pandas/index.pyx in pandas.index.IndexEngine.get_loc (pandas/index.c:4433)()

pandas/index.pyx in pandas.index.IndexEngine.get_loc (pandas/index.c:4279)()

pandas/src/hashtable_class_helper.pxi in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:13742)()

pandas/src/hashtable_class_helper.pxi in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:13696)()

KeyError: ('Class', 'Class Description')

In [410]:
source = ColumnDataSource(
    data=dict(
        lat=latitude_data[13:130],
        lon=longitude_data[13:130],
    )
)

print(source.data.values)
circle = Circle(x="lon", y="lat", size=15, fill_color="blue", fill_alpha=0.8, line_color=None)
plot.add_glyph(source, circle)

plot.add_tools(PanTool(), WheelZoomTool(), BoxSelectTool())


<built-in method values of PropertyValueDict object at 0x111bd4888>

Ploting the geographic data in Google Maps. Note that the 'show' function receives another parameter 'notebook_handle=True' responsible for tell Bhoke to do a inline plot


In [411]:
show(plot,notebook_handle=True)


Out[411]:

<Bokeh Notebook handle for In[9]>

Which sort of complaints are most common, TOP 10?


In [413]:
#Using the agg function allows you to calculate the frequency for each group using the standard library function len.
#Sorting the result by the aggregated column code_count values, in descending order, then head selecting the top n records, then reseting the frame; will produce the top n frequent records
top = montydata.groupby(['Class','Class Description'])['Class'].agg({"frequency": len}).sort_values("frequency", ascending=False).head(40).reset_index()
top['frequency'] = (top['frequency']/number_of_registries[0])*100
top


Out[413]:
Class Class Description frequency
0 2812 DRIVING UNDER THE INFLUENCE 7.317386
1 1834 CDS-POSS MARIJUANA/HASHISH 5.708417
2 2938 POL INFORMATION 5.096495
3 614 LARCENY FROM AUTO OVER $200 3.911164
4 617 LARCENY FROM BUILDING OVER $200 3.829860
5 2942 MENTAL TRANSPORT 3.598785
6 1412 VANDALISM-MOTOR VEHICLE 3.260730
7 2941 LOST PROPERTY 3.119517
8 619 LARCENY OTHER OVER $200 2.790021
9 634 LARCENY FROM AUTO UNDER $50 2.610296
10 1013 FORGERY/CNTRFT - IDENTITY THEFT 2.550387
11 613 LARCENY SHOPLIFTING OVER $200 2.263683
12 623 LARCENY SHOPLIFTING $50 - $199 2.092516
13 2216 LIQUOR - DRINK IN PUB OVER 21 2.062562
14 2413 DISORDERLY CONDUCT 1.985536
15 811 ASSAULT & BATTERY - CITIZEN 1.634644
16 624 LARCENY FROM AUTO $50 - $199 1.523386
17 1011 FORGERY/CNTRFT-CRDT CARDS 1.463477
18 2943 MISSING PERSON 1.459198
19 821 SIMPLE ASSAULT - CITIZEN 1.330823
20 1864 CDS IMPLMNT-MARIJUANA/HASHISH 1.270914
21 711 AUTO THEFT - PASSENGER VEHICLE 1.253798
22 813 ASSAULT & BATTERY SPOUSE/PARTNER 1.240960
23 635 LARCENY AUTO PART UNDER $50 1.142539
24 2111 JUVENILE RUNAWAY 1.104027
25 633 LARCENY SHOPLIFTING UNDER $50 1.104027
26 512 BURG FORCE-RES/DAY 1.027002
27 2737 TRESPASSING 0.954256
28 2913 SUDDEN DEATH NATURAL 0.954256
29 627 LARCENY FROM BUILDING $50-$199 0.945697
30 1411 VANDALISM-DWELLING 0.907185
31 639 LARCENY OTHER UNDER $50 0.894347
32 629 LARCENY OTHER $50 - $199 0.864393
33 1014 FORGERY/CNTRFT-ALL OTHER 0.842997
34 513 BURG FORCE-RES/TIME UNK 0.787368
35 616 LARCENY BICYCLE OVER $200 0.761693
36 1417 VANDALISM-OTHER 0.736018
37 637 LARCENY FROM BLDG UNDER $50 0.706064
38 1824 CDS-SELL-MARIJUANA/HASHISH 0.671830
39 514 BURG FORCE-COMM/NIGHT 0.637597

In [414]:
from decimal import *
#Configure precision
getcontext().prec = 2

parcial_perc = top['frequency'].sum()
parcial_perc = round(parcial_perc,2)

print("The crimes above are responsible for up to " + str(parcial_perc) + "% of the total crimes")


The crimes above are responsible for up to 78.42% of the total crimes

What are the Classes of Classes (Master Classes) of complaints?


In [416]:
#Considering the top crimes

#copy
top_classes_top = top

#Creation of a Master Class
top_classes_top['Master Class'] = 0
aux = top_classes_top['Master Class'].astype(float,copy=True)
top_classes_top['Master Class'] = aux
top_classes_top['Master Class'] = top_classes_top['Class']/100
top_classes_top['Master Class'] = top_classes_top['Master Class'].round()
top_classes_top['Master Class'] = top_classes_top['Master Class']*100
aux = top_classes_top['Master Class'].astype(int,copy=True)
top_classes_top['Master Class'] = aux
#teste.describe
#top_classes_top
#top_classes_top['Master Class'].describe()
#top_classes_top.dtypes
top_classes_top


Out[416]:
Class Class Description frequency Master Class
0 2812 DRIVING UNDER THE INFLUENCE 7.317386 2800
1 1834 CDS-POSS MARIJUANA/HASHISH 5.708417 1800
2 2938 POL INFORMATION 5.096495 2900
3 614 LARCENY FROM AUTO OVER $200 3.911164 600
4 617 LARCENY FROM BUILDING OVER $200 3.829860 600
5 2942 MENTAL TRANSPORT 3.598785 2900
6 1412 VANDALISM-MOTOR VEHICLE 3.260730 1400
7 2941 LOST PROPERTY 3.119517 2900
8 619 LARCENY OTHER OVER $200 2.790021 600
9 634 LARCENY FROM AUTO UNDER $50 2.610296 600
10 1013 FORGERY/CNTRFT - IDENTITY THEFT 2.550387 1000
11 613 LARCENY SHOPLIFTING OVER $200 2.263683 600
12 623 LARCENY SHOPLIFTING $50 - $199 2.092516 600
13 2216 LIQUOR - DRINK IN PUB OVER 21 2.062562 2200
14 2413 DISORDERLY CONDUCT 1.985536 2400
15 811 ASSAULT & BATTERY - CITIZEN 1.634644 800
16 624 LARCENY FROM AUTO $50 - $199 1.523386 600
17 1011 FORGERY/CNTRFT-CRDT CARDS 1.463477 1000
18 2943 MISSING PERSON 1.459198 2900
19 821 SIMPLE ASSAULT - CITIZEN 1.330823 800
20 1864 CDS IMPLMNT-MARIJUANA/HASHISH 1.270914 1900
21 711 AUTO THEFT - PASSENGER VEHICLE 1.253798 700
22 813 ASSAULT & BATTERY SPOUSE/PARTNER 1.240960 800
23 635 LARCENY AUTO PART UNDER $50 1.142539 600
24 2111 JUVENILE RUNAWAY 1.104027 2100
25 633 LARCENY SHOPLIFTING UNDER $50 1.104027 600
26 512 BURG FORCE-RES/DAY 1.027002 500
27 2737 TRESPASSING 0.954256 2700
28 2913 SUDDEN DEATH NATURAL 0.954256 2900
29 627 LARCENY FROM BUILDING $50-$199 0.945697 600
30 1411 VANDALISM-DWELLING 0.907185 1400
31 639 LARCENY OTHER UNDER $50 0.894347 600
32 629 LARCENY OTHER $50 - $199 0.864393 600
33 1014 FORGERY/CNTRFT-ALL OTHER 0.842997 1000
34 513 BURG FORCE-RES/TIME UNK 0.787368 500
35 616 LARCENY BICYCLE OVER $200 0.761693 600
36 1417 VANDALISM-OTHER 0.736018 1400
37 637 LARCENY FROM BLDG UNDER $50 0.706064 600
38 1824 CDS-SELL-MARIJUANA/HASHISH 0.671830 1800
39 514 BURG FORCE-COMM/NIGHT 0.637597 500

Describing 'Master Classes'


In [432]:
#Inserting the description of the Master Classes
top_classes_top['Master Class Description'] ='' 

top_classes_top[top_classes_top['Master Class'] == 600]
test_top = top_classes_top


test_top.loc[(test_top['Master Class'] ==  600),'Master Class Description'] = 'LARCENY'
test_top.loc[(test_top['Master Class'] == 2900),'Master Class Description'] = 'MISC'
test_top.loc[(test_top['Master Class'] == 1400),'Master Class Description'] = 'VANDALISM'
test_top.loc[(test_top['Master Class'] == 1000),'Master Class Description'] = 'FORGERY/CNTRFT'
test_top.loc[(test_top['Master Class'] ==  500),'Master Class Description'] = 'BURGLARY'
test_top.loc[(test_top['Master Class'] ==  800),'Master Class Description'] = 'ASSAULT & BATTERY'
test_top.loc[(test_top['Master Class'] == 1800),'Master Class Description'] = 'CONTROLLED DANGEROUS SUBSTANCE POSSESSION'
test_top.loc[(test_top['Master Class'] ==  700),'Master Class Description'] = 'THEFT'
test_top.loc[(test_top['Master Class'] == 2100),'Master Class Description'] = 'JUVENILE RUNAWAY'
test_top.loc[(test_top['Master Class'] == 2800),'Master Class Description'] = 'DRIVING UNDER THE INFLUENCE'
test_top.loc[(test_top['Master Class'] == 1900),'Master Class Description'] = 'CONTROLLED DANGEROUS SUBSTANCE IMPLMNT'
test_top.loc[(test_top['Master Class'] == 2200),'Master Class Description'] = 'LIQUOR - DRINK IN PUB OVER 21'
test_top.loc[(test_top['Master Class'] == 2400),'Master Class Description'] = 'DISORDERLY CONDUCT'
test_top.loc[(test_top['Master Class'] == 2700),'Master Class Description'] = 'TRESPASSING'

test_top


Out[432]:
Class Class Description frequency Master Class Master Class Description
0 2812 DRIVING UNDER THE INFLUENCE 7.317386 2800 DRIVING UNDER THE INFLUENCE
1 1834 CDS-POSS MARIJUANA/HASHISH 5.708417 1800 CONTROLLED DANGEROUS SUBSTANCE POSSESSION
2 2938 POL INFORMATION 5.096495 2900 MISC
3 614 LARCENY FROM AUTO OVER $200 3.911164 600 LARCENY
4 617 LARCENY FROM BUILDING OVER $200 3.829860 600 LARCENY
5 2942 MENTAL TRANSPORT 3.598785 2900 MISC
6 1412 VANDALISM-MOTOR VEHICLE 3.260730 1400 VANDALISM
7 2941 LOST PROPERTY 3.119517 2900 MISC
8 619 LARCENY OTHER OVER $200 2.790021 600 LARCENY
9 634 LARCENY FROM AUTO UNDER $50 2.610296 600 LARCENY
10 1013 FORGERY/CNTRFT - IDENTITY THEFT 2.550387 1000 FORGERY/CNTRFT
11 613 LARCENY SHOPLIFTING OVER $200 2.263683 600 LARCENY
12 623 LARCENY SHOPLIFTING $50 - $199 2.092516 600 LARCENY
13 2216 LIQUOR - DRINK IN PUB OVER 21 2.062562 2200 LIQUOR - DRINK IN PUB OVER 21
14 2413 DISORDERLY CONDUCT 1.985536 2400 DISORDERLY CONDUCT
15 811 ASSAULT & BATTERY - CITIZEN 1.634644 800 ASSAULT & BATTERY
16 624 LARCENY FROM AUTO $50 - $199 1.523386 600 LARCENY
17 1011 FORGERY/CNTRFT-CRDT CARDS 1.463477 1000 FORGERY/CNTRFT
18 2943 MISSING PERSON 1.459198 2900 MISC
19 821 SIMPLE ASSAULT - CITIZEN 1.330823 800 ASSAULT & BATTERY
20 1864 CDS IMPLMNT-MARIJUANA/HASHISH 1.270914 1900 CONTROLLED DANGEROUS SUBSTANCE IMPLMNT
21 711 AUTO THEFT - PASSENGER VEHICLE 1.253798 700 THEFT
22 813 ASSAULT & BATTERY SPOUSE/PARTNER 1.240960 800 ASSAULT & BATTERY
23 635 LARCENY AUTO PART UNDER $50 1.142539 600 LARCENY
24 2111 JUVENILE RUNAWAY 1.104027 2100 JUVENILE RUNAWAY
25 633 LARCENY SHOPLIFTING UNDER $50 1.104027 600 LARCENY
26 512 BURG FORCE-RES/DAY 1.027002 500 BURGLARY
27 2737 TRESPASSING 0.954256 2700 TRESPASSING
28 2913 SUDDEN DEATH NATURAL 0.954256 2900 MISC
29 627 LARCENY FROM BUILDING $50-$199 0.945697 600 LARCENY
30 1411 VANDALISM-DWELLING 0.907185 1400 VANDALISM
31 639 LARCENY OTHER UNDER $50 0.894347 600 LARCENY
32 629 LARCENY OTHER $50 - $199 0.864393 600 LARCENY
33 1014 FORGERY/CNTRFT-ALL OTHER 0.842997 1000 FORGERY/CNTRFT
34 513 BURG FORCE-RES/TIME UNK 0.787368 500 BURGLARY
35 616 LARCENY BICYCLE OVER $200 0.761693 600 LARCENY
36 1417 VANDALISM-OTHER 0.736018 1400 VANDALISM
37 637 LARCENY FROM BLDG UNDER $50 0.706064 600 LARCENY
38 1824 CDS-SELL-MARIJUANA/HASHISH 0.671830 1800 CONTROLLED DANGEROUS SUBSTANCE POSSESSION
39 514 BURG FORCE-COMM/NIGHT 0.637597 500 BURGLARY

Could we categorize the types of crimes in violent or not?

According to wikipedia (https://en.wikipedia.org/wiki/Violent_crime) include but are not limited to this list of crimes: Typically, violent criminals includes aircraft hijackers, bank robbers, muggers, burglars, terrorists, carjackers, rapists, kidnappers, torturers, active shooters, murderers, gangsters, drug cartels, and others.

Only analysing each master class we can see that only tree master classes are considered violent, that are: 500 - BURGLARY, 800 - ASSAULT & BATTERY and 700 - THEFT.


In [439]:
test_top['Violent crime'] = False

test_top.loc[(test_top['Master Class'] ==  500),'Violent crime'] = True
test_top.loc[(test_top['Master Class'] ==  800),'Violent crime'] = True
test_top.loc[(test_top['Master Class'] ==  700),'Violent crime'] = True

test_top.sort_values(['Violent crime', 'frequency'], ascending=False, axis=0, kind='quicksort')


Out[439]:
Class Class Description frequency Master Class Master Class Description Violent crime
15 811 ASSAULT & BATTERY - CITIZEN 1.634644 800 ASSAULT & BATTERY True
19 821 SIMPLE ASSAULT - CITIZEN 1.330823 800 ASSAULT & BATTERY True
21 711 AUTO THEFT - PASSENGER VEHICLE 1.253798 700 THEFT True
22 813 ASSAULT & BATTERY SPOUSE/PARTNER 1.240960 800 ASSAULT & BATTERY True
26 512 BURG FORCE-RES/DAY 1.027002 500 BURGLARY True
34 513 BURG FORCE-RES/TIME UNK 0.787368 500 BURGLARY True
39 514 BURG FORCE-COMM/NIGHT 0.637597 500 BURGLARY True
0 2812 DRIVING UNDER THE INFLUENCE 7.317386 2800 DRIVING UNDER THE INFLUENCE False
1 1834 CDS-POSS MARIJUANA/HASHISH 5.708417 1800 CONTROLLED DANGEROUS SUBSTANCE POSSESSION False
2 2938 POL INFORMATION 5.096495 2900 MISC False
3 614 LARCENY FROM AUTO OVER $200 3.911164 600 LARCENY False
4 617 LARCENY FROM BUILDING OVER $200 3.829860 600 LARCENY False
5 2942 MENTAL TRANSPORT 3.598785 2900 MISC False
6 1412 VANDALISM-MOTOR VEHICLE 3.260730 1400 VANDALISM False
7 2941 LOST PROPERTY 3.119517 2900 MISC False
8 619 LARCENY OTHER OVER $200 2.790021 600 LARCENY False
9 634 LARCENY FROM AUTO UNDER $50 2.610296 600 LARCENY False
10 1013 FORGERY/CNTRFT - IDENTITY THEFT 2.550387 1000 FORGERY/CNTRFT False
11 613 LARCENY SHOPLIFTING OVER $200 2.263683 600 LARCENY False
12 623 LARCENY SHOPLIFTING $50 - $199 2.092516 600 LARCENY False
13 2216 LIQUOR - DRINK IN PUB OVER 21 2.062562 2200 LIQUOR - DRINK IN PUB OVER 21 False
14 2413 DISORDERLY CONDUCT 1.985536 2400 DISORDERLY CONDUCT False
16 624 LARCENY FROM AUTO $50 - $199 1.523386 600 LARCENY False
17 1011 FORGERY/CNTRFT-CRDT CARDS 1.463477 1000 FORGERY/CNTRFT False
18 2943 MISSING PERSON 1.459198 2900 MISC False
20 1864 CDS IMPLMNT-MARIJUANA/HASHISH 1.270914 1900 CONTROLLED DANGEROUS SUBSTANCE IMPLMNT False
23 635 LARCENY AUTO PART UNDER $50 1.142539 600 LARCENY False
24 2111 JUVENILE RUNAWAY 1.104027 2100 JUVENILE RUNAWAY False
25 633 LARCENY SHOPLIFTING UNDER $50 1.104027 600 LARCENY False
27 2737 TRESPASSING 0.954256 2700 TRESPASSING False
28 2913 SUDDEN DEATH NATURAL 0.954256 2900 MISC False
29 627 LARCENY FROM BUILDING $50-$199 0.945697 600 LARCENY False
30 1411 VANDALISM-DWELLING 0.907185 1400 VANDALISM False
31 639 LARCENY OTHER UNDER $50 0.894347 600 LARCENY False
32 629 LARCENY OTHER $50 - $199 0.864393 600 LARCENY False
33 1014 FORGERY/CNTRFT-ALL OTHER 0.842997 1000 FORGERY/CNTRFT False
35 616 LARCENY BICYCLE OVER $200 0.761693 600 LARCENY False
36 1417 VANDALISM-OTHER 0.736018 1400 VANDALISM False
37 637 LARCENY FROM BLDG UNDER $50 0.706064 600 LARCENY False
38 1824 CDS-SELL-MARIJUANA/HASHISH 0.671830 1800 CONTROLLED DANGEROUS SUBSTANCE POSSESSION False

Acording to the data, almost 80% of the crimes selected from the total of crimes, the violent crimes are only


In [450]:
value_percentage = test_top[test_top['Violent crime'] == True]['frequency'].sum()
value_percentage = round(value_percentage,2)
print(str(value_percentage) + '% of the total crimes')


7.91% of the total crimes

Wich period (morning, afternoon, night) of the day that most complaints occur


In [327]:
#Considering the top crimes
day_process = montydata

Wich day of the week that most complaints occur


In [ ]:
#Considering the top crimes

Wich month of the years that most complaints occur


In [ ]:
#Considering the top crimes

These complainsts are related with holidays?


In [ ]:
#Considering the top crimes

What period of time (time of day/day of the week/month of the year) has correlation with the type of complaint


In [ ]:
#Considering the top crimes